package com.woniu.adopt.mapper;

import com.woniu.adopt.entity.Permission;
import com.woniu.adopt.vo.PermissionVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Permission record);

    Permission selectByPrimaryKey(Integer id);

    List<Permission> selectAll();

    int updateByPrimaryKey(Permission record);


    //下面这些复制从K15

    List<PermissionVo> selectAllMenu();

    List<Permission> selectPermissionByName(String name);

    List<Permission> selectParentPermission();

    //根据权限ID 删除 角色和权限 的中间表数据
    @Delete("delete from t_role_permission where permission_id = #{id}")
    int deleteRoleAndPermissionByPerId(int id);

    List<Integer> selectPermissionIdByRoleId(int roleid);

    List<PermissionVo> selectMenuByManager(int mid);

    @Update("update t_permission set del=0,update_time=now() where id=#{value}")
    int doRecycle(int id);
}